package Time;

public class TimeHour {
    int hour,minute,second;
    public TimeHour( int hour, int minute, int second){
        this.hour=hour;
        this.minute=minute;
        this.second=second;
        rationalize();
    }
     void rationalize(){
        int sc = 0;
        sc=second/60;
        second%=second;
        minute+=sc;
        sc=minute/60;
        minute%=60;
        hour+=sc;
        hour%=24;
    }
    public TimeHour add(TimeHour in){
        int ch=this.hour+in.hour;
        int cm=this.minute+in.minute;
        int cs=this.second+in.second;
        return new TimeHour(ch,cm,cs);
    }
    public  String toString(){
        return String.format("%d:%2d:%2d",hour,minute,second);
    }
}
